package com.ciaojian.client.service;

import com.ciaojian.core.model.HairArchiveImg;
import com.ciaojian.core.service.HairArchiveImgService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author oxiny
 */
@AllArgsConstructor
@Service
public class HairArchiveImgServiceImpl extends HairArchiveImgService {


    /**
     * 用户收藏图片
     *
     * @param userId /
     * @return /
     */
    public List<Map<String, Object>> listFavorite(Integer userId) {
        return this.baseMapper.listFavorite(userId);
    }

    /**
     * 收藏图片
     *
     * @param id 图片ID
     */
    public void favorite(Integer id) {
        lambdaUpdate()
                .set(HairArchiveImg::getFavorite, 1)
                .eq(HairArchiveImg::getId, id)
                .update();
    }
}
